home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DLLCust_Files / TRANSFRM / AUTOCORR.C next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  1.2 KB  |  49 lines

  1. // Dynamic link library implementation of NeuroSolutions Axon component 
  2.  
  3. #include "NSDLL.h" 
  4.  
  5. /****************************/
  6. /* Transform implementation */
  7.  
  8. __declspec(dllexport) BOOL performTransform(
  9.     DLLData    *instance,    // Pointer to instance data
  10.     NSFloat    *data,         // Pointer to the buffered data
  11.     int     length,        // Length of the buffer to be transformed
  12.     int     channel        // Current channal number
  13.     )
  14. {
  15.     int i,j, start=0, stop=length;
  16.     NSFloat *corr = (NSFloat*)calloc(length, sizeof(NSFloat));
  17.  
  18.     for (i=0; i<length; i++) {
  19.         for (j=start; j<stop; j++) 
  20.             corr[i] += data[j]*data[j-start];
  21.         start++;
  22.     }
  23.     for (i=0; i<length; i++)
  24.         data[i] = corr[i];
  25.     free(corr);
  26.  
  27.     // Return whether or not to display this channel
  28.     return TRUE; 
  29. }
  30.  
  31. /******************************************/
  32. /* Management of instance data (OPTIONAL) */
  33. /*
  34. __declspec(dllexport) DLLData *allocTransform(
  35.     DLLData    *oldInstance,    // Pointer to the last instance if reallocating
  36.     int     length,        // Length of the buffer to be transformed
  37.     int     channels    // Number of channels to be transformed
  38.     )
  39. {
  40.     DLLData instance=NULL;
  41.     return instance;
  42. }
  43.  
  44. __declspec(dllexport) void freeTransform(DLLData *instance)
  45. {
  46.     freeDLLInstance(instance);
  47. }
  48. */
  49.